package pro.shushi.pamirs.hr.api.model.eam;

import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxDetail;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxForm;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTableSearch;
import pro.shushi.pamirs.hr.api.enums.*;
import pro.shushi.pamirs.hr.api.enums.eam.*;
import pro.shushi.pamirs.hr.api.model.eam.common.AbstractOrgBaseModel;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;
import pro.shushi.pamirs.meta.constant.ExpConstants;

import java.math.BigDecimal;
import java.util.Date;

// 模型中UX开头的注解(UxForm/UxTable/UxDetail等)可以不用写，都可在设计器中进行可视化配置; 代码里面写这些注解是为了默认页面的交互
@UxForm(grid = 3)
@UxDetail(grid = 3)
@Model.model(EamUkHd.MODEL_MODEL)
@Model(displayName = "保养单主表",labelFields = {"ukCode"})
@Model.Advanced(table="eam_uk_hd",unique = {"orgCode, ukCode"})
public class EamUkHd extends AbstractOrgBaseModel {

    public static final String MODEL_MODEL = "hr.simple.eamUkHd";

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field(displayName = "组织编码", required = true,priority = 1L)
    private String orgCode;

    @UxTableSearch.FieldWidget(@UxWidget())
    @UxForm.FieldWidget(@UxWidget(readonly = "true", hint = "为空时自动生成"))
    @Field.Sequence(sequence = "SEQ", prefix = "UK", size = 5, step = 1, initial = 10000)
    @Field(displayName = "保养单编码", priority = 2L)
    public String ukCode;

    @Field.Enum(size = 4)
    @Field(displayName = "保养类型", required = true,priority = 3L,defaultValue = "2")
    public UkCycTypeEnum ukCycType;

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field(displayName = "关联编码", required = true,invisible = true)
    public String refCode;

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field(displayName = "型号编码", required = true,invisible = true)
    public String eamModelCode;

    @Field.Date
    @Field(displayName = "计划开始时间",required = true)
    public Date ukPbdate;

    @Field.Date
    @Field(displayName = "计划结束时间",required = true)
    public Date ukPedate;

    @Field.Date
    @Field(displayName = "实际开始时间")
    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
    public Date rkPbdate;

    @Field.Date
    @Field(displayName = "实际结束时间")
    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
    public Date rkPedate;

    @Field(displayName = "保养人")
    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
    public String ukUser;

    @Field.Enum(size='4')
    @Field(displayName = "保养结果", required = true,defaultValue = "0")
    @UxForm.FieldWidget(@UxWidget(readonly = ExpConstants.idValueNotExist))
    public UkRsEnum ukRs;

    @Field.Enum(size='4')
    @Field(displayName = "优先级", required = true,defaultValue = "0")
    public PirEnum pir;

    @Field.Integer
    @Field(displayName = "前置天数", required = true,defaultValue = "0")
    public Integer preDay;

    @Field.Enum(size='4')
    @Field(displayName = "状态", required = true,defaultValue = "0")
    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
    public UkStatEnum ukStat;

    @Field.Money(M=20,D=6)
    @Field(displayName = "停机时间(分钟)", required = true,defaultValue = "0")
    @UxForm.FieldWidget(@UxWidget(readonly = ExpConstants.idValueNotExist))
    public BigDecimal stopTs;

    @Field.Money(M=20,D=6)
    @Field(displayName = "停机时间(分钟)", required = true,defaultValue = "0")
    @UxForm.FieldWidget(@UxWidget(readonly = ExpConstants.idValueNotExist))
    public BigDecimal stopPts;

    @Field.Enum(size='1')
    @Field(displayName = "带病作业",  defaultValue = "n")
    @UxForm.FieldWidget(@UxWidget(readonly = ExpConstants.idValueNotExist))
    public BooleanConstantEnum isSick;

    @Field.Enum(size='4')
    @Field(displayName = "计划类型", required = true,defaultValue = "2")
    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
    public PlanTypeEnum planType;

    @Field.Enum(size='4')
    @Field(displayName = "来源", required = true,defaultValue = "2",invisible = true)
    public EamModelSrcEnum eamModelSrc;

    @Field.Text
    @Field(displayName = "备注")
    private String remark;


}
